package com.example.bittraffic;

import java.util.ArrayList;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyAdapter extends BaseAdapter {
	private Context context;
	private LayoutInflater Inflater;
	private ArrayList<TaxiDTO> arrDTO = new ArrayList<TaxiDTO>();
	private int layout;
	int[] a;
	
	public MyAdapter(Context context, int layout, ArrayList<TaxiDTO> mItems, int[] a) {
		this.context = context;
		this.Inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.arrDTO = mItems;
		this.layout = layout;
		this.a = a;
	}
	
	@Override
	public int getCount() {
		return arrDTO.size();
	}

	@Override
	public Object getItem(int position) {
		return arrDTO.get(position).toString();
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View converterView, ViewGroup parent) {
		if (converterView == null) {
			converterView = this.Inflater.inflate(layout, parent, false);
		}
		
		TextView txtView1 = (TextView) converterView.findViewById(R.id.text1);
		txtView1.setText(arrDTO.get(position).company);
		
		TextView txtView2 = (TextView)converterView.findViewById(R.id.text2);
		txtView2.setText(arrDTO.get(position).number);
		
		TextView txtCount =(TextView)converterView.findViewById(R.id.txtCount);
		txtCount.setText(a[position] + "");
		
		return converterView;
	}
	
	public int getint(int position){
//		Log.e("포지션", position+"");
		int c = position;
		return a[c];
	}
}